﻿<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>文件上传 - 仅允许上传图片</title>
    <link href="demo.css" rel="stylesheet" type="text/css" />
    <link href="../css/uploader.css" rel="stylesheet" type="text/css" />
</head>

<body>
    <div id="header" class="header">Header</div>
    <div class="main">
        <div id="sidebar" class="sidebar"></div>
        <div class="content">
            <div>
                <a id="upload-target" class="x-button">选择文件并上传</a>
            </div>
            <div id="upload-view"></div>
        </div>
    </div>

    <script type="text/javascript" src="demo.js"></script>

    <script type="text/javascript" src="../js/Q.js"></script>
    <script type="text/javascript" src="../js/Q.Uploader.js"></script>
    <script type="text/javascript" src="../js/Q.Uploader.UI.js"></script>

    <script type="text/javascript">
        new Q.Uploader({
            url: UPLOAD_URL + "?type=image",
            target: document.getElementById("upload-target"),
            view: document.getElementById("upload-view"),

            allows: ".jpg,.png,.gif,.bmp",

            //回调函数
            on: {
                add: function (task) {
                    if (task.disabled) return alert("允许上传的文件格式为：" + this.ops.allows);
                }
            }
        });
    </script>
</body>
</html>